﻿

module AsyncCheck.AsyncCheck

open CheckBaseLib
open System
open System.Net

let AsyncCheck () =
    let ips = [180 .. 190]
    let ip = Dns.GetHostAddresses(Dns.GetHostName()).[0].ToString().Split('.')
    let pref = System.String.Format("{0}.{1}.{2}.", ip.[0], ip.[1], ip.[2])
    let task =
        seq {
            for i in ips ->
                async { return CheckBaseLib.Check.CheckIP (pref, i) }
        }

    let res = 
        Async.RunSynchronously (Async.Parallel task)
        |> Array.fold (fun state e -> state || e) false

    res